home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DLLCust_Files / AXON / BIASA.C < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  1.1 KB  |  41 lines

  1. // Dynamic link library implementation of NeuroSolutions BiasAxon component using the
  2.  
  3. #include "NSDLL.h" 
  4.  
  5. /***********************************/
  6. /* Forward activation of component */
  7.  
  8. __declspec(dllexport) void performAxon(
  9.     DLLData *instance,    // Pointer to instance data
  10.     NSFloat    *data,         // Pointer to the layer of processing elements (PEs)
  11.     int     rows,        // Number of rows of PEs in the layer
  12.     int     cols        // Number of columns of PEs in the layer  
  13.     )
  14. {
  15.     int i,length=rows*cols;
  16.     NSFloat *bias = getWeights(instance); 
  17.  
  18.     for (i=0; i<length; i++)
  19.         data[i] += bias[i]; 
  20. }
  21.  
  22. /******************************************/
  23. /* Management of instance data (OPTIONAL) */
  24.  
  25. __declspec(dllexport) DLLData *allocAxon(
  26.     DLLData    *oldInstance,    // Pointer to the last instance if reallocating
  27.     int     rows,            // Number of rows of PEs in the layer
  28.     int     cols            // Number of columns of PEs in the layer  
  29.     )
  30. {
  31.     DLLData *instance = allocDLLInstance(oldInstance);
  32.     setWeights(instance, rows*cols);
  33.     return instance;
  34. }
  35.  
  36. __declspec(dllexport) void freeAxon(DLLData *instance)
  37. {
  38.     freeDLLInstance(instance);
  39. }
  40.  
  41.